<template>
	<!-- 文章详情 -->
	<view :class="model+'-wrap'">
		<view :class="'p-sticky-'+model">
			<view class="status_bar">

			</view>
			<view class="nav_bar flex align-center justify-between">
				<view @click="$tool.goBack()" class="f0 p-3">
					<image class="fanhui_icon" :src="'/static/images/fanhui_'+model+'.png'" mode=""></image>
				</view>
				<view class="A-Medium" :class="'navTitle_'+model">

				</view>
				<view class="f0 p-3 opacity0">
					<image class="fanhui_icon" :src="'/static/images/fanhui_'+model+'.png'" mode=""></image>
				</view>
			</view>
		</view>
		<view class="h32">

		</view>
		<!-- <view class="title mx-3 A-Medium" :class="model=='light'?'titleLight':''">
			{{title}}
		</view>
		<view class="flex align-center mt-3 mx-3 desc mb-4 A-Regular">
			<view class="mr-3">
				{{createBy}}
			</view>
			<view class="">
				{{createTime}}
			</view>
		</view> -->
		<view class="mx-3 A-Regular content" :class="model=='light'?'contentLight':''" v-html="content">

		</view>
	</view>
</template>

<script>
	import {
		spotBuyRule,
		activityRuleList,
		aboutAgreement,
		aboutLegal,
		aboutPlatform,
		aboutPrivacy,
		helpBeginners,
		accountSecurity,
		helpFraud,
		helpWithdrawal,
		helpBuySell,
		helpTrade
	} from '@/core/api/index.js';
	export default {
		data() {
			return {
				// title:'',
				// createBy:'',
				// createTime:'',
				type: 1, //1 现货交易规则 2活动规则 3用户协议 4法律声明 5平台介绍6隐私条款 7-12 13套利交易规则 14期权交易规则 15 储蓄池交易规则
				content: ''

			}
		},
		onLoad(options) {
			this.type = options.type;
			if (this.type == 1) {
				spotBuyRule({
					ruleType:'spot'
				}).then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 2) {
				activityRuleList().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 3) {
				aboutAgreement().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 4) {
				aboutLegal().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 5) {
				aboutPlatform().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 6) {
				aboutPrivacy().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 7) {
				helpBeginners().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 8) {
				accountSecurity().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 9) {
				helpFraud().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 10) {
				helpWithdrawal().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 11) {
				helpBuySell().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 12) {
				helpTrade().then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 13) {
				spotBuyRule({
					ruleType:'arbitrage'
				}).then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 14) {
				spotBuyRule({
					ruleType:'options'
				}).then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
			if (this.type == 15) {
				spotBuyRule({
					ruleType:'liquidity'
				}).then(res => {
					this.content = res.result.records[0].mobileView;
				})
			}
		},
		onReady() {
			this.$tool.setStatusBarStyle(this.model);
		},
		onShow() {
			this.$tool.setStatusBarStyle(this.model);
			const pages = getCurrentPages();
			const page = pages[pages.length - 1];
			const currentWebview = page.$getAppWebview();
			if(this.model == "dark"){
				currentWebview.setStyle({
					background: "#0E0F11"
				});
			}else{
				currentWebview.setStyle({
					background: "#ffffff"
				});
			}
		},
		computed: {
			i18n() {
				return this.$t('mine');
			},
			model() {
				return this.$store.state.config.model;
			}
		},
	}
</script>

<style scoped lang="scss">
	.h32 {
		height: 32rpx;
	}

	.title {
		font-size: 38rpx;
		color: #F7F7F7;
	}

	.titleLight {
		color: #0E0F11;
	}

	.desc {
		font-size: 24rpx;
		color: #7F838D;
	}

	.content {
		font-size: 30rpx;
		color: #AAACB8;
	}

	.contentLight {
		color: #47474A;
	}
</style>